<style lang="scss" scoped>
    .navbar{
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 15px 0;
        width: 25%;
        img{
            height:60px;
            width: 60px;
            margin-bottom: 10px;
        }
    }
</style>
<template>
    <div class="flex-1 mr20 ml20">

        <navbar class="mt10 mb10"></navbar>

        <div class="flex ui-border-top ui-border-bottom pt30 pb20 mb35">
            <div class="flex-1 text-center">
                <div class="f-color-grey">收录彩金</div>
                <div class="f-color-orange f20">{{couponCountData.Couponamount}}个</div>
            </div>
            <div class="flex-1 text-center">
                <div class="f-color-grey">收录白菜</div>
                <div class="f-color-orange f20">{{couponCountData.baicaiamount}}棵</div>
            </div>
            <div class="flex-1 text-center">
                <div class="f-color-grey">入驻公司</div>
                <div class="f-color-orange f20">{{couponCountData.compnayamount}}家</div>
            </div>
            <div class="flex-1 text-center">
                <div class="f-color-grey">彩金提款</div>
                <div class="f-color-orange f20">{{couponCountData.extractamount}}元</div>
            </div>
        </div>

        <!-- 彩金点评 -->
        <div>
            <img src="~@/icons/cjdp.png" width="80" height="38" class="block mb5">
            <ui-empty :data="dianpinList"></ui-empty>
            <router-link tag="div" :to="{name:'文章详情',query:{id:item.id}}" v-for="item in dianpinList" :key="item.id" class="mb20 cursor-pointer">
                <img v-if="item.smeta.cover" :src="item.smeta.cover" style="width:100%">
                <p class="f16">{{item.post_title}}</p>
                <div class="flex row-between f-color-grey">
                    <span>{{item.post_date}}</span>
                    <span>{{item.post_like}}赞</span>
                </div>
            </router-link>
        </div>

        <hr class="mr10 ml10">

        <div>
            <ui-title>玩家评论</ui-title>
            <ui-empty :data="commentsList"></ui-empty>
            <div v-for="item in commentsList" :key="item.id" class="flex col-center pr20 mb15">
                <ui-img :url="item.avatar" size="30px" class="ui-circle bg-grey mr5"></ui-img>
                <div style="width:60px;color:#10a8ae" class="clamp-1">{{item.user_nicename || '匿名'}}</div>
                <!-- <span class="ml5 f10 f-color-grey">{{item.createtime_show}}</span> -->
                <router-link :to="{name:'彩金详情',query:{id:item.post_id}}" class="clamp-1 flex-1 pl10 pr10 f-color-text">{{item.content}}</router-link>
                <span class="flex col-center f-color-grey f10">
                    <icon v-if="item.liked==1" name="heart" class="mr5 f-color-red"></icon>
                    <icon v-else name="heart-o" class="mr5"></icon>
                    {{item.like_num}}
                </span>
            </div>
        </div>

        <hr class="mr10 ml10">

        <div class="pr20">
            <ui-title>玩家提款</ui-title>
            <ui-empty :data="shaiList"></ui-empty>
            <router-link :to="{name:'彩金详情',query:{id:item.coupon_id}}" class="flex mb15" v-for="item in shaiList" :key="item.id">
                <ui-img :url="item.smeta && item.smeta[0]" style="width:100px;height:60px"></ui-img>
                <div class="pl10 pb15 ui-border-bottom flex-1">
                    <div class="f16">{{item.user_nicename}} 提款{{parseInt(item.amount)}}元</div>
                    <!-- <div class="clamp-1">中奖游戏:古玩有、蜂窝肺、绯闻绯闻品</div> -->
                    <div class="f8 f-color-grey">{{item.tdate}}</div>
                </div>
            </router-link>
        </div>

    </div>
</template>
<script>
    import navbar from '@/views/彩金宝/彩金菜单'
    export default {
        components:{
            navbar
        },
        data(){
            return {
                dianpinList:[],
                commentsList:[],
                shaiList:[],
                couponCountData:{}
            }
        },
        created(){
            // 彩金点评 属于分类 id:7 
            this.$http.get('index.php?g=home&m=content&a=sql_posts_paged',{
                params:{
                    cid: 6,
                    page_size:3
                }
            })
            .then(({data})=>{
                // console.log('彩金点评',data)
                if (data.code===1) {
                    this.dianpinList = data.data
                }
            })

            // 评论
            this.$http.get('index.php?g=home&m=Comments&a=comments_list', {
                params:{
                    page_size:6,
                    post_table:'game_coupon'
                }
            })
            .then(({data})=>{
                // console.log('彩金首页评论:', data)
                if (data.code===1) {
                    this.commentsList = data.data
                }
            })

            // 晒图
            this.$http.get('index.php?g=home&m=GameCouponExtract&a=extract_list',{
                params:{
                    page_size: 5,//只取3条评论
                }
            })
            .then(({data}) => {
                // console.log(`彩金首页晒提款:`, data);
                if(data.code==1){
                    this.shaiList = data.data
                }
            })

            // 彩金数据统计
            this.$http.get('index.php?g=home&m=index&a=index')
            .then(({data})=>{
                // console.log('彩金数据统计',data)
                if (data.code===1) {
                    this.couponCountData = data.data
                }
            })
        },
    }
</script>